﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    //static void Person_FirstNameChanged(object sender, PropertyChangedEventArgs e)
    //{
    //    Console.WriteLine("First name changed!");
    //}

    //static void Person_LastNameChanged(object sender, PropertyChangedEventArgs e)
    //{
    //    Console.WriteLine("Last name changed!");
    //}

    //static void Person_AgeChanged(object sender, PropertyChangedEventArgs e)
    //{
    //    Console.WriteLine("Age name changed!");
    //}

    //static void Person_BirthDateChanged(object sender, PropertyChangedEventArgs e)
    //{
    //    Console.WriteLine("Birth date name changed!");
    //}

    static void Person_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        //Console.WriteLine(e.));
        if (e.Name.Equals("Birth date"))
        {
            Console.WriteLine("Property '{0}' changed from \"{1:dd.MM.yyyy}\" to \"{2:dd.MM.yyyy}\".", e.Name, e.OldValue, e.NewValue);
        }
        else
        {
            Console.WriteLine("Property '{0}' changed from \"{1}\" to \"{2}\".", e.Name, e.OldValue, e.NewValue);
        }
    }

    static void Main()
    {
        Person chovek = new Person("Ivan","Marinov",21,new DateTime(1990,5,11));
        //chovek.FirstNameChanged += new PropertyChangedEventHandler(Person_FirstNameChanged);
        //chovek.LastNameChanged += new PropertyChangedEventHandler(Person_LastNameChanged);
        //chovek.AgeChanged += new PropertyChangedEventHandler(Person_AgeChanged);
        //chovek.BirthDateChanged += new PropertyChangedEventHandler(Person_BirthDateChanged);
        chovek.PropertyChanged += new PropertyChangedEventHandler(Person_PropertyChanged);
        chovek.FirsName = "Kamen";
        chovek.LastName = "Ivanov";
        chovek.Age = 22;
        chovek.BirthDate = new DateTime(1987, 9, 17);
    }
}
